/*
路由组件模块
*/

import Vue from 'vue'
import VueRouter from 'vue-router'

// 通过通配的方式获取全部的路由文件
const routes = require.context( '@/app/', true, /(.*?)\/router\/(.*?)\.js$/ );
const allRouters=routes.keys().map(key => (routes(key).default || routes(key)));

Vue.use(VueRouter)

const router = new VueRouter({
    linkActiveClass: 'active',
    routes: [
        {
            path: '/',
            component: () => import('../layout/layout0301/home/pages/layout.vue'),
            // redirect: '/dashboard1',   // ！ 默认进入的路由
            children: [
                ...allRouters,
            ]
        },
        {
            path: '/login',
            component: () => import('../layout/layout0301/login/pages/login.vue'),
        }
    ]
})

export default router;
